package com.xudu.xianrendongculturaltravelbackend.controller;

import com.xudu.xianrendongculturaltravelbackend.app.ReviewAgentApp;
import com.xudu.xianrendongculturaltravelbackend.common.BaseResponse;
import com.xudu.xianrendongculturaltravelbackend.common.ResultUtils;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

import java.util.UUID;

/**
 * @className: ReviewController
 * @description: TODO
 * @author: xudu
 * @create: 2025-05-07
 */
@RestController
@RequestMapping("/review")
public class ReviewController {

    @Resource
    private ReviewAgentApp reviewAgentApp;

    /**
     * 获取优化后的文档
     * @param document 需要修改的文件
     * @param prompt 优化提示
     * @return 返回优化后的文档
     */
    @PostMapping("get/optimization/document")
    public BaseResponse<String> getOptimizationDocument(@RequestParam("document") String document, @RequestParam("prompt") String prompt) {

        String chatId = UUID.randomUUID().toString();
        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.append("请优化以下文件：").append("\n").append(document).append("\n").append(prompt);
        String result = reviewAgentApp.doChatWithRag(prompt, chatId);

        return ResultUtils.success(result);
    }



}
